package com.stage.communication;

import com.stage.helper.InputManager;

import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.net.Socket;

/**
 * Created by Stage on 2017/3/24.
 */
public class ClientInput implements Runnable {
    private Socket socket;
    private InputManager inputManager;
    public ClientInput(Socket socket) {
        this.socket = socket;
        this.inputManager = new InputManager();
    }
    @Override
    public void run() {
        try {
            BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
            while (true) {
                String clientInput = inputManager.inputString("请输入您要输入的话：   ");
                writer.write(clientInput);
                writer.newLine();
                writer.flush();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
